<?php
/*
  This page loops through the glossary.csv and displays them in a table format.
*/
?>

<?php
  include('util.php');
  $glossary = array();
  $csv = csv_to_array('glossary.csv');
  for ($i = 0; $i < count($csv); $i++) {
    $glossary[$csv[$i]['glossary_text']] = $csv[$i]['definition'];
  }
  uksort($glossary,'strnatcasecmp');
?>
<body>
  <div id="site">
    <?php include_once('header.php')?>
    <div id="content">
      <div class="home-screen clearfix">
        <div class="left-column" style="width: 100%;">
          <h2 style="margin-bottom: 20px;">Glossary of Terms</h2>
          <table class="standard-table">
            <tr><th>Term</th><th>Definition</th></tr>
<?php
  foreach ($glossary as $k => $v) {
    echo "<tr><td>$k</td><td>$v</td></tr>\n";
  }
?>
          </table>
        </div>
      </div>
    </div>
    <?php include_once('footer.php')?>
  </div>
</body>
